package com.cloudsigns.factorymanager2.engineering.presenter;

import com.cloudsigns.factorymanager2.engineering.IView.INormalDailyFeedBackForInstallView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualDailyFeedBackForInstallView;
import com.cloudsigns.factorymanager2.engineering.model.INormalDailyFeedBackForInstallModel;
import com.cloudsigns.factorymanager2.engineering.model.IUnusualFeedBackForInstallModel;
import com.cloudsigns.factorymanager2.engineering.model.NormalDailyFeedBackForInstallModel;
import com.cloudsigns.factorymanager2.engineering.model.UnusualFeedBackForInstallModel;

/**
 * Created by tony on 2018/4/17.
 */

public class NormalFeedBackForInstallPresenter {
    private INormalDailyFeedBackForInstallView view;
    private INormalDailyFeedBackForInstallModel model;
    private android.os.Handler mHandler = new android.os.Handler();

    public NormalFeedBackForInstallPresenter(INormalDailyFeedBackForInstallView view) {
        this.view = view;
        this.model = new NormalDailyFeedBackForInstallModel();
    }

    public void submitNormalFeedBackForInstall() {


        model.submitNormalFeedBackForInstall(view.getId(), view.getImgUrlList(), view.getItemId(), view.getStatus(), view.getType(), view.getcontent(), view.getfeedbackContentRemark(), view.getfeedbackSubType(),
                new NormalDailyFeedBackForInstallModel.OnNormalFeedBackFroInstallListener() {
                    @Override
                    public void submitNormalFeedBackForInstallSunccessed() {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.submitNormalFeedBackForInstallSuccessed();
                                view.hideLoading();
                            }
                        });
                    }

                    @Override
                    public void submitNormalFeedBackForInstallFailed(final String desc) {
                        //需要在UI线程执行
                        mHandler.post(new Runnable() {
                            @Override
                            public void run() {
                                view.submitNormalFeedBackForInstallFailed(desc);
                                view.hideLoading();
                            }
                        });
                    }
                });

    }
}
